import Vue from 'vue'
import VueRouter from 'vue-router'
import Footer from '@/components/footer.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/guide'
  },
  {
    path:"/guide",
    name:'guide',
    component:()=>import('@/views/guide/index')
  },
  {
    path: '/home', // 地址栏输入的那个网址
    name: 'home', // 起的名字 -- 命名路由
    // 当前地址栏输入这个网址时，你需要显示的是哪一个页面
    // 路由的懒加载
    components: {
      default: () => import('@/views/home/index'),
      footer: Footer
    }
  },
  {
    path: '/kind',
    name: 'kind',
    // component: () => import('@/views/kind/index.vue')
    components: {
      default: () => import('@/views/kind/index'),
      footer: Footer
    }
  },
  {
    path: '/user',
    name: 'user',
    components: {
      default: () => import('@/views/user/index'),
      footer: Footer
    }
  },
  {
    path: '/recommend',
    name: 'recommend',
    components: {
      default: () => import('@/views/recommend/index'),
      footer: Footer
    },
    // redirect:'/recommend/kind1',
    // children:[
    //   {
    //     path:"kind1",
    //     name:"kind1",
    //     component:()=>import("@/views/kind1/index")
    //   }
    // ]
  },
  {
    path:"/city",
    name:'city',
    component:()=>import('@/views/city/index')
  },
  {
    path:"/search",
    name:'search',
    component:()=>import('@/views/search/index')
  },
  {
    path:"/login",
    name:'login',
    component:()=>import('@/views/login/index')
  },
  {
    path:"/register",
    name:'register',
    component:()=>import('@/views/register/index')
  },
  {
    path: '*',
    name: 'notfound',
    component: () => import('@/views/notfound/index')
  }
]

const router = new VueRouter({
  mode: 'history',
  // mode:'hash',// 默认的
  base: process.env.BASE_URL,
  routes
})

export default router
